CalendarService = Packages.com.google.gdata.client.calendar.CalendarService;
gdata           = Packages.com.google.gdata.data;
AclEntry        = Packages.com.google.gdata.data.acl.AclEntry;
AclScope        = Packages.com.google.gdata.data.acl.AclScope
CalendarAclRole = Packages.com.google.gdata.data.calendar.CalendarAclRole
CalendarEventEntry =Packages.com.google.gdata.data.calendar.CalendarEventEntry
DateTime         =  Packages.com.google.gdata.data.DateTime;
When             = Packages.com.google.gdata.data.extensions.When;
PlainTextConstruct = Packages.com.google.gdata.data.PlainTextConstruct
CalendarEventFeed = Packages.com.google.gdata.data.calendar.CalendarEventFeed
CalendarQuery     = Packages.com.google.gdata.client.calendar.CalendarQuery
Feed              = Packages.com.google.gdata.data.Feed
Query             = Packages.com.google.gdata.client.Query
CalendarFeed      = Packages.com.google.gdata.data.calendar.CalendarFeed



  function main( ui ) {
     try{
       
        var json = ui.getQueryParameters().getFirst("json");
        var o = new JSONObject( json );
        var EMAIL_JSON_KEY="EMAIL";
       
        var service = new CalendarService("demo-calendar-1");
        var username = "soulsoftware2010@gmail.com";
        var password = "2010soulsoftware";
        var calendarNameEmployee=o.getString(EMAIL_JSON_KEY);
       
        service.setUserCredentials(username, password);
     
        var feedUrl = new java.net.URL("https://www.google.com/calendar/feeds/default/allcalendars/full");
        var resultFeed = service.getFeed(feedUrl, CalendarFeed); 
        for (var i = 0; i < resultFeed.getEntries().size(); i++) {
          var entry = resultFeed.getEntries().get(i);
          if (entry.getTitle().getPlainText().equals(calendarNameEmployee)){
             return  entry.getId();
         } 
       }
    }catch( e ) {
        return e;
    }
    
    return "Calendar not found";

}